package com.gitee.wsl.ext.map


fun <K, V> Map<K, V>.invert() = map { Pair(it.value, it.key) }.toMap()


/**
 * Inverts the [Map] such that the values are now the keys and the keys are now the values.
 */
//fun <K, V> Map<K, V>.invert(): Map<V, K> {
//    val map = HashMap<V, K>(this.size)
//    forEach { (key, value) ->
//        map[value] = key
//    }
//    require(map.size == this.size)
//    return map
//}
